---
title: InAppPurchases
description: A library for accepting in-app purchases.
sourceCodeUrl: 'https://github.com/expo/expo/tree/main/packages/expo-in-app-purchases'
packageName: 'expo-in-app-purchases'
---

import APISection from '~/components/plugins/APISection';
import { APIInstallSection } from '~/components/plugins/InstallSection';
import PlatformsSection from '~/components/plugins/PlatformsSection';

> **warning** **Deprecated:** This module is no longer maintained and will be removed in a future SDK release. Development was paused in June 2022 and the package was deprecated in August 2023. We recommend one of the following, both of which are compatible with [EAS Build](/build/introduction/) and [development builds](/develop/development-builds/use-development-builds/):<br/><br/>
> • [`react-native-iap`](https://github.com/dooboolab/react-native-iap), which provides an interface to client-side Google Play Billing and StoreKit API's<br/>
> • [`react-native-purchases`](https://www.revenuecat.com/blog/engineering/expo-in-app-purchase-tutorial/), which also integrates with RevenueCat's services for server-side receipt validation and more.

`expo-in-app-purchases` provides an API to accept payments for in-app products. Internally this relies on the [Google Play Billing](https://developer.android.com/google/play/billing/integrate) library on Android and the [StoreKit](https://developer.apple.com/documentation/storekit?language=objc) framework on iOS.

<PlatformsSection android ios />

## Installation

This library is **not** available in the [Expo Go app](https://expo.dev/go) due to app store restrictions. You can create a [development build](/develop/development-builds/create-a-build/) to work with this library.

<APIInstallSection />

## Setup

> Note that in-app purchases require physical devices to work on both platforms and therefore **cannot be tested on emulators or simulators**.

### Android

On Android, you must first create an entry for your app and upload a release APK in the [Google Play Console](https://developer.android.com/distribute/console/). Then, configure in-app purchases and details under **Monetize > Products > In-app products**.

Then to test your purchases, you must publish your app to a closed or open testing track in Google Play. Note that it may take a few hours for the app to be available for testers. Ensure the testers you invite (including yourself) opt into your app's test. On your test's opt-in URL, your testers will get an explanation of what it means to be a tester and a link to opt-in. At this point, they're all set and can start making purchases once they download your app or build from the source. For more information on testing, follow [instructions from Android's documentation](https://developer.android.com/google/play/billing/test).

#### Associating users and handling out-of-app purchases

Google Play API does not provide information about the purchasing user. To associate such data (for example, to link users in your app's backend to a purchase), you must provide both the [`obfuscatedAccountId` and `obfuscatedProfileId`](#iappurchaseitemoptions) values in the `IAPPurchaseItemOptions` object passed to `InAppPurchases.purchaseItemAsync()`.

If you offer subscriptions, they can be configured for repurchase up to a year after expiration. In this case, your purchase listener callback should handle [out-of-app payments](https://developer.android.com/google/play/billing/integrate#ooap). In addition, these payments can be initiated at any time, even if the app is not installed or inactive. So you must provide a feature for users to claim and activate the purchase. Since there's no way to link an obfuscated account or profile ID with the purchase, your app's backend must manage this scenario appropriately.

### iOS

To use the In-App Purchases API on iOS, you'll need to sign the [Paid Applications Agreement](https://developer.apple.com/help/app-store-connect/get-started/app-store-connect-workflow) and set up your banking and tax information. You also need to enable the [In-App Purchases capability](https://help.apple.com/xcode/mac/current/#/dev88ff319e7) for your app in Xcode.

Next, create an entry for your app in [App Store Connect](https://appstoreconnect.apple.com/) and configure your in-app purchases, including details (such as name, pricing, and description) that highlight the features and functionality of your in-app products. Make sure each product's status says `Ready to Submit`. Otherwise, it will not be queryable from within your app when you are testing. Be sure to add any necessary metadata to do so including uploading a screenshot (this can be anything when you're testing) and review notes. Your app's status must also say `Ready to Submit` but you do not need to submit your app or its products for review to test purchases in sandbox mode.

Now you can create a [sandbox account](https://developer.apple.com/help/app-store-connect/test-in-app-purchases/create-sandbox-apple-ids/) to test in-app purchases before you make your app available.

For more information, see [Apple's workflow for configuring In-App Purchases](https://developer.apple.com/help/app-store-connect/configure-in-app-purchase-settings/overview-for-configuring-in-app-purchases).

## API

```js
import * as InAppPurchases from 'expo-in-app-purchases';
```

<APISection packageName="expo-in-app-purchases" apiName="InAppPurchases" />
